import { Component, OnInit, ViewChild } from '@angular/core';
import { NzModalRef, NzMessageService } from 'ng-zorro-antd';
import { _HttpClient } from '@delon/theme';
import { SFSchema, SFUISchema } from '@delon/form';

@Component({
  selector: 'app-act-model-edit',
  templateUrl: './edit.component.html',
})
export class ActModelEditComponent implements OnInit {
  record: any = {};
  i: any;
  schema: SFSchema = {
    properties: {
      key: { type: 'string', title: 'key' },
      name: { type: 'string', title: '名称', maxLength: 15 },
      category: { type: 'string', title: '分类' },
    },
    required: ['key', 'name', 'category'],
  };
  ui: SFUISchema = {

  };

  constructor(
    private modal: NzModalRef,
    public http: _HttpClient,
  ) {}

  ngOnInit(): void {
   this.i=this.record;
  }

  save(value: any) {
    this.http.post(`act/modeler/add`, value).subscribe(res => {
      this.modal.close(true);
    });
  }

  close() {
    this.modal.destroy();
  }
}
